package org.jivesoftware.smack.provider;

import java.util.ArrayList;
import org.jivesoftware.smack.packet.DefaultPacketExtension;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.Privacy;
import org.jivesoftware.smack.packet.PrivacyItem;
import org.xmlpull.v1.XmlPullParser;

public class PrivacyProvider
  implements IQProvider
{
  public IQ parseIQ(XmlPullParser paramXmlPullParser)
    throws Exception
  {
    Privacy localPrivacy = new Privacy();
    localPrivacy.addExtension(new DefaultPacketExtension(paramXmlPullParser.getName(), paramXmlPullParser.getNamespace()));
    int i = 0;
    while (i == 0)
    {
      int j = paramXmlPullParser.next();
      if (j == 2)
      {
        String str;
        if (paramXmlPullParser.getName().equals("active"))
        {
          str = paramXmlPullParser.getAttributeValue("", "name");
          if (str == null)
            localPrivacy.setDeclineActiveList(true);
          else
            localPrivacy.setActiveName(str);
        }
        else if (paramXmlPullParser.getName().equals("default"))
        {
          str = paramXmlPullParser.getAttributeValue("", "name");
          if (str == null)
            localPrivacy.setDeclineDefaultList(true);
          else
            localPrivacy.setDefaultName(str);
        }
        else if (paramXmlPullParser.getName().equals("list"))
        {
          parseList(paramXmlPullParser, localPrivacy);
        }
      }
      else if ((j == 3) && (paramXmlPullParser.getName().equals("query")))
      {
        i = 1;
      }
    }
    return localPrivacy;
  }

  public void parseList(XmlPullParser paramXmlPullParser, Privacy paramPrivacy)
    throws Exception
  {
    int i = 0;
    String str = paramXmlPullParser.getAttributeValue("", "name");
    ArrayList localArrayList = new ArrayList();
    while (i == 0)
    {
      int j = paramXmlPullParser.next();
      if (j == 2)
      {
        if (paramXmlPullParser.getName().equals("item"))
          localArrayList.add(parseItem(paramXmlPullParser));
      }
      else if ((j == 3) && (paramXmlPullParser.getName().equals("list")))
        i = 1;
    }
    paramPrivacy.setPrivacyList(str, localArrayList);
  }

  public PrivacyItem parseItem(XmlPullParser paramXmlPullParser)
    throws Exception
  {
    int i = 0;
    String str1 = paramXmlPullParser.getAttributeValue("", "action");
    String str2 = paramXmlPullParser.getAttributeValue("", "order");
    String str3 = paramXmlPullParser.getAttributeValue("", "type");
    boolean bool = true;
    if ("allow".equalsIgnoreCase(str1))
      bool = true;
    else if ("deny".equalsIgnoreCase(str1))
      bool = false;
    int j = Integer.parseInt(str2);
    PrivacyItem localPrivacyItem = new PrivacyItem(str3, bool, j);
    localPrivacyItem.setValue(paramXmlPullParser.getAttributeValue("", "value"));
    while (i == 0)
    {
      int k = paramXmlPullParser.next();
      if (k == 2)
      {
        if (paramXmlPullParser.getName().equals("iq"))
          localPrivacyItem.setFilterIQ(true);
        if (paramXmlPullParser.getName().equals("message"))
          localPrivacyItem.setFilterMessage(true);
        if (paramXmlPullParser.getName().equals("presence-in"))
          localPrivacyItem.setFilterPresence_in(true);
        if (paramXmlPullParser.getName().equals("presence-out"))
          localPrivacyItem.setFilterPresence_out(true);
      }
      else if ((k == 3) && (paramXmlPullParser.getName().equals("item")))
      {
        i = 1;
      }
    }
    return localPrivacyItem;
  }
}

/* Location:           D:\hygieia\userclient\common\libs\easemobchat_2.1.8.jar
 * Qualified Name:     org.jivesoftware.smack.provider.PrivacyProvider
 * JD-Core Version:    0.6.1
 */